import * as TYPES from './actionTypes'
// import utils from '@/utils/utils'

const intialState = {
  isLogin: false,
  info: {
    cPhone: '',
    cUsername: '',
    cPhoto: ''
  }
}

const reducer = function (state = intialState, action) {
  switch (action.type) {
      // 登录
    case TYPES.SAVE_USER_INFO:
      return Object.assign({}, state, {
        info: action.info,
        isLogin: true
      })
      // 登出
    case TYPES.SIGN_OUT:
      return Object.assign({}, state, {
        isLogin: false,
        info: {}
      })
      
    default:
      return state
  }
}
export default reducer